package com.hzw.saas.api.old.storage.exception;

import java.util.ArrayList;
import java.util.List;

import com.hzw.saas.api.old.storage.bo.ResourceFolderConflictBO;
import lombok.Getter;
import lombok.Setter;

/**
 * 文件未找到异常
 *
 * @author zzl
 * @since 02/25/2021
 */
public class FolderConflictException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    @Getter
    @Setter
    private List<ResourceFolderConflictBO> errorFileList = new ArrayList<>();

    private FolderConflictException() {
        super();
    }

    private FolderConflictException(String message) {
        super(message);
    }

    public FolderConflictException(String message, List<ResourceFolderConflictBO> errorFileList) {
        this(message);
        this.errorFileList = errorFileList;
    }

    public FolderConflictException(List<ResourceFolderConflictBO> errorFileList) {
        this();
        this.errorFileList = errorFileList;
    }

    public static FolderConflictException build(String message, List<ResourceFolderConflictBO> errorFileList) {
        return new FolderConflictException(message, errorFileList);
    }

    public static FolderConflictException build(List<ResourceFolderConflictBO> errorFileList) {
        return new FolderConflictException(errorFileList);
    }

    public static FolderConflictException build(String message, ResourceFolderConflictBO errorFile) {
        FolderConflictException exception = new FolderConflictException(message);
        exception.getErrorFileList().add(errorFile);
        return exception;
    }

    public static FolderConflictException build(ResourceFolderConflictBO errorFile) {
        FolderConflictException exception = new FolderConflictException();
        exception.getErrorFileList().add(errorFile);
        return exception;
    }

}
